// Copyright (C) 2016 All rights reserved.
// Author: liufeng11@letv.com (Liu Feng)
// Description:

#include "MyFontFeatureExtractor.h"
#include "HaarFontFeatureExtractor.h"
#include "HogFontFeatureExtractor.h"
#include "MySimilarity.h"
#include "SimilarCharacter.h"
#include <stdio.h>

void FindSimilar() {
  HogFontFeatureExtractor ffe;
  Similarity si;

  while(true) {
    unsigned int charCode = 0;
    printf("Please input char code:");
    scanf("%x", &charCode);
    printf("%04x\n", charCode);

    SimilarCharacter<10> sc(&si, &ffe);
    try { 
      std::vector<mypair> r = sc(charCode);
      printf("size = %d\n", r.size());

      for (size_t i = 0; i < r.size(); ++i) {
        printf("%04x = %f\n", r[i].second, r[i].first);
      }
    }
    catch(...) {
      printf("无效输入\n");
      fflush(stdin);
    }
  }
}


int main() {

  FindSimilar();
  return 0;
}
